<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://127.0.0.1/cms_edu/Template/default/css/style.css" />
<script type="text/javascript" src="http://127.0.0.1/cms_edu/Template/default/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms_edu/Template/default/js/js.js"></script>
<!--载入hdjs，前面必须有一个jq-->
<link rel="stylesheet" type="text/css" href="http://127.0.0.1/cms_edu/Static/hdjs/hdjs.css"/>
<script src="http://127.0.0.1/cms_edu/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function(){
		 $('#regForm').validate({
            username_reg: {
                rule: {
                    required: true,
                     ajax:{url:'<?php echo U("Member/ajaxCheckUser");?>'}
                },
                error: {
                    required: '用户名不能为空',
                    
                },
                success: '验证通过',
                message: '请输入用户名'
            },
	        nickname: {

                rule: {
                    required: true,
                },
 
                error: {
                    required: '昵称不能为空',
                },
       
                success: '验证通过',
  
                message: '请输入昵称'
            },
             password_reg1: {

                rule: {
                    required: true,
                    minlen:6
                },

                error: {
                    required: '密码不能为空',
                    minlen:'密码不得少于6位'
                },

                success: '验证通过',

                message: '请输入密码'
            },
            password_reg2: {

                rule: {
                    required: true,
                    confirm:'password_reg1'
                },

                error: {
                    required: '密码不能为空',
                    confirm:'两次不一样'
                },

                success: '验证通过',

                message: '请再次输入密码'
            },
            code: {

                rule: {
                    required: true,
                    ajax:{url:'<?php echo U("Member/ajaxCheckCode");?>'}
                },

                error: {
                    required: '验证码不能为空',
                },

                success: '验证通过',

                message: '请输入验证码'
            },
		
		});
		
	})
</script>
</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href=""><img src="http://127.0.0.1/cms_edu/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<li>
					<a href="<?php echo U('index/index');?>">首页</a>
				</li>
				
				<?php
    $topCate=K('Category')->where('pid=0 AND is_show=1')->limit(5)->order('csort ASC')->all();
    foreach ($topCate as $filed):
   //如果是列表页是静态的时候
	if($filed['is_listhtml']){
		$filed['url'] = 'http://127.0.0.1/cms_edu/Static/' . C('index_tpl_style') . '/' . $filed['htmldir'] . '/index.html';
	}else{
		$filed['url'] = U('List/index',array('cid'=>$filed['cid']));
	}
?>

				<li>
					<a href="<?php echo $filed['url'];?>"><?php echo $filed['cname'];?></a>
				</li>
				
<?php
endforeach
?>
				
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			<div id="loginInfo" class='loginInfo'>
				<?php if (empty($hd['session']['uname'])){ ?>
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
			<a href="javascript:showRegBox();">注册</a>
			<?php }else{ ?>
			 <span><?php echo $hd['session']['uname'];?></span><a href="<?php echo U('Member/out');?>">退出</a> 
			 <?php } ?>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="<?php echo U('Member/login');?>" method="post">
			<div class="login_hide_box">
				<img src="http://127.0.0.1/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：</p>
					<input type="text" name="username" class="text" />
					<p>密码：</p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="<?php echo U('Member/register');?>" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：</p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="<?php echo U('Member/code');?>" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			
			<p><span class="title">最新消息：</span>
				<?php
	//如果有分页的话
	if(0){
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0")->count();
		$pageObj = new Page($total,0,5);
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0")->limit($pageObj->limit())->order("sendtime DESC")->all();
		$page = $pageObj->show();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0")->limit("1")->order("sendtime DESC")->all();
	}
    foreach ($arcData as $filed):
		if($filed['is_archtml']){
		$filed['url'] = 'http://127.0.0.1/cms_edu/Static/' . C('index_tpl_style') . '/' . $filed['htmldir'] . '/arc/'.$filed['aid'].'.html';
	}else{
		$filed['url']=U('Content/index',array('aid'=>$filed['aid']));
	}
    
   //组合分类的url
   $field['curl'] = U('List/index',array('cid'=>$field['cid']));
   
    //评论总数
    $filed['total'] = M('comment')->where("article_aid=" . $filed['aid'])->count();
    
?>

			<a href="<?php echo $filed['url'];?>"><?php echo $filed['title'];?></a></p>
				
<?php
endforeach
?>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
